const {basename, dirname, extname} = require('path');

const filePath = 'c:\\www\\index.html';

console.log(dirname(filePath)); // c:\www
console.log(extname(filePath)); // .html
console.log(basename(filePath)); // index.html